@@ -1,16 +0,0 @@  | 
            ||
| 1 | 
                -# -*- coding: utf-8 -*-  | 
            |
| 2 | 
                -  | 
            |
| 3 | 
                -import redis_extensions as redis  | 
            |
| 4 | 
                -  | 
            |
| 5 | 
                -  | 
            |
| 6 | 
                -def redis_conf(conf):  | 
            |
| 7 | 
                -    return {
               | 
            |
| 8 | 
                -        'host': conf.get('HOST', 'localhost'),
               | 
            |
| 9 | 
                -        'port': conf.get('PORT', 6379),
               | 
            |
| 10 | 
                -        'password': '{}:{}'.format(conf.get('USER', ''), conf.get('PASSWORD', '')) if conf.get('USER') else '',
               | 
            |
| 11 | 
                -        'db': conf.get('db', 0),
               | 
            |
| 12 | 
                - }  | 
            |
| 13 | 
                -  | 
            |
| 14 | 
                -  | 
            |
| 15 | 
                -def redis_connect(conf):  | 
            |
| 16 | 
                - return redis.StrictRedisExtensions(connection_pool=redis.ConnectionPool(**redis_conf(conf)))  | 
            
                @@ -15,6 +15,8 @@ https://docs.djangoproject.com/en/1.8/ref/settings/  | 
            ||
| 15 | 15 | 
                # Build paths inside the project like this: os.path.join(BASE_DIR, ...)  | 
            
| 16 | 16 | 
                import os  | 
            
| 17 | 17 | 
                 | 
            
| 18 | 
                +from django_redis_connector import connector  | 
            |
| 19 | 
                +  | 
            |
| 18 | 20 | 
                 | 
            
| 19 | 21 | 
                BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))  | 
            
| 20 | 22 | 
                PROJ_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))  | 
            
                @@ -371,32 +373,29 @@ SYSTEM_MESSAGE_AVATAR = PAI2_LOGO_URL  | 
            ||
| 371 | 373 | 
                COMMENT_MESSAGE_AVATAR = PAI2_LOGO_URL  | 
            
| 372 | 374 | 
                THUMBUP_MESSAGE_AVATAR = PAI2_LOGO_URL  | 
            
| 373 | 375 | 
                 | 
            
| 374 | 
                -try:  | 
            |
| 375 | 
                - from func_settings import redis_connect  | 
            |
| 376 | 
                -    REDIS_CACHE = redis_connect(REDIS.get('default', {}))
               | 
            |
| 377 | 
                -  | 
            |
| 378 | 
                -    Q_CLUSTER = {
               | 
            |
| 379 | 
                - 'name': 'pai2',  | 
            |
| 380 | 
                - 'workers': 8,  | 
            |
| 381 | 
                - 'recycle': 500,  | 
            |
| 382 | 
                - 'timeout': 60,  | 
            |
| 383 | 
                - 'compress': True,  | 
            |
| 384 | 
                - 'cpu_affinity': 1,  | 
            |
| 385 | 
                - 'save_limit': 250,  | 
            |
| 386 | 
                - 'queue_limit': 500,  | 
            |
| 387 | 
                - 'label': 'Django Q',  | 
            |
| 388 | 
                - 'redis_conn': REDIS_CACHE,  | 
            |
| 389 | 
                - }  | 
            |
| 376 | 
                +# Redis 连接  | 
            |
| 377 | 
                +REDIS_CACHE = connector(REDIS.get('default', {}))
               | 
            |
| 378 | 
                +  | 
            |
| 379 | 
                +Q_CLUSTER = {
               | 
            |
| 380 | 
                + 'name': 'pai2',  | 
            |
| 381 | 
                + 'workers': 8,  | 
            |
| 382 | 
                + 'recycle': 500,  | 
            |
| 383 | 
                + 'timeout': 60,  | 
            |
| 384 | 
                + 'compress': True,  | 
            |
| 385 | 
                + 'cpu_affinity': 1,  | 
            |
| 386 | 
                + 'save_limit': 250,  | 
            |
| 387 | 
                + 'queue_limit': 500,  | 
            |
| 388 | 
                + 'label': 'Django Q',  | 
            |
| 389 | 
                + 'redis_conn': REDIS_CACHE,  | 
            |
| 390 | 
                +}  | 
            |
| 390 | 391 | 
                 | 
            
| 391 | 
                -    DJLOGIT = {
               | 
            |
| 392 | 
                - 'level': 'DEBUG',  | 
            |
| 393 | 
                - 'class': 'rlog.RedisListHandler',  | 
            |
| 394 | 
                - 'redis_client': REDIS_CACHE,  | 
            |
| 395 | 
                - 'key': 'django:logit:pai2',  | 
            |
| 396 | 
                - 'formatter': 'verbose',  | 
            |
| 397 | 
                - }  | 
            |
| 398 | 
                -except ImportError:  | 
            |
| 399 | 
                - REDIS_CACHE = None  | 
            |
| 392 | 
                +DJLOGIT = {
               | 
            |
| 393 | 
                + 'level': 'DEBUG',  | 
            |
| 394 | 
                + 'class': 'rlog.RedisListHandler',  | 
            |
| 395 | 
                + 'redis_client': REDIS_CACHE,  | 
            |
| 396 | 
                + 'key': 'django:logit:pai2',  | 
            |
| 397 | 
                + 'formatter': 'verbose',  | 
            |
| 398 | 
                +}  | 
            |
| 400 | 399 | 
                 | 
            
| 401 | 400 | 
                # 日志设置  | 
            
| 402 | 401 | 
                 LOGGING = {
               | 
            
                @@ -2,11 +2,11 @@  | 
            ||
| 2 | 2 | 
                CodeConvert==2.0.4  | 
            
| 3 | 3 | 
                Django==1.8.4  | 
            
| 4 | 4 | 
                MySQL-python==1.2.5  | 
            
| 5 | 
                -Pillow==4.3.0  | 
            |
| 5 | 
                +Pillow==5.0.0  | 
            |
| 6 | 6 | 
                StatusCode==1.0.0  | 
            
| 7 | 7 | 
                TimeConvert==1.4.1  | 
            
| 8 | 8 | 
                cryptography==1.5.2  | 
            
| 9 | 
                -django-admin==1.1.0  | 
            |
| 9 | 
                +django-admin==1.1.1  | 
            |
| 10 | 10 | 
                django-curtail-uuid==1.0.0  | 
            
| 11 | 11 | 
                django-detect==1.0.5  | 
            
| 12 | 12 | 
                django-file-md5==1.0.1  | 
            
                @@ -15,14 +15,15 @@ django-json-render==1.0.0  | 
            ||
| 15 | 15 | 
                django-json-response==1.1.5  | 
            
| 16 | 16 | 
                django-logit==1.0.6  | 
            
| 17 | 17 | 
                django-mobi==0.1.7  | 
            
| 18 | 
                -django-models-ext==1.0.5  | 
            |
| 18 | 
                +django-models-ext==1.1.0  | 
            |
| 19 | 19 | 
                django-multidomain==1.1.4  | 
            
| 20 | 20 | 
                django-paginator2==1.0.3  | 
            
| 21 | 
                +django-redis-connector==1.0.1  | 
            |
| 21 | 22 | 
                django-response==1.0.0  | 
            
| 22 | 23 | 
                django-rlog==1.0.7  | 
            
| 23 | 24 | 
                django-shortuuidfield==0.1.3  | 
            
| 24 | 25 | 
                django-six==1.0.4  | 
            
| 25 | 
                -django-uniapi==1.0.0  | 
            |
| 26 | 
                +django-uniapi==1.0.1  | 
            |
| 26 | 27 | 
                django-we==1.1.2  | 
            
| 27 | 28 | 
                djangorestframework==3.7.2  | 
            
| 28 | 29 | 
                furl==1.0.1  |